class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.t: B = None
        self.y: E = None
        self.p: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.y: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.q: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.v: B = None
        self.q: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.q: C = None
        self.y: A = None
        self.txt = txt

j = A("j")
k = B("k")
g = C("g")
l = D("l")
c = E("c")

j.s = c
j.y = c
j.p = c
j.t = k
k.p = c
k.y = j
g.o = k
g.q = l
l.u = k
l.v = k
l.q = g
c.o = k
c.q = g
c.y = j
assert g.o.p.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.t: B = None
        self.y: E = None
        self.p: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.y: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.q: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.v: B = None
        self.q: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.q: C = None
        self.y: A = None
        self.txt = txt

j = A("j")
k = B("k")
g = C("g")
l = D("l")
c = E("c")

j.s = c
j.y = c
j.p = c
j.t = k
k.p = c
k.y = j
g.o = k
g.q = l
l.u = k
l.v = k
l.q = g
c.o = k
c.q = g
c.y = j
assert g.o.p.o.y.txt == "j"