class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: A = None
        self.z: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.p: E = None
        self.o: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: D = None
        self.y: B = None
        self.t: D = None
        self.txt = txt

b = A("b")
j = B("j")
k = C("k")
f = D("f")
c = E("c")
i = A("i")

b.q = k
b.z = k
b.p = i
j.v = f
j.o = f
j.p = c
k.x = j
k.q = b
f.y = c
f.u = b
c.u = f
c.t = f
c.y = j
i.q = k
i.z = k
i.p = b
assert k.x.p.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: A = None
        self.z: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.p: E = None
        self.o: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: D = None
        self.y: B = None
        self.t: D = None
        self.txt = txt

b = A("b")
j = B("j")
k = C("k")
f = D("f")
c = E("c")
i = A("i")

b.q = k
b.z = k
b.p = i
j.v = f
j.o = f
j.p = c
k.x = j
k.q = b
f.y = c
f.u = b
c.u = f
c.t = f
c.y = j
i.q = k
i.z = k
i.p = b
assert k.x.p.t.txt == "f"