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

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

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.r: E = None
        self.txt = txt

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

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

b = A("b")
d = B("d")
c = C("c")
n = D("n")
k = E("k")
m = A("m")

b.z = m
b.t = c
d.o = c
c.o = k
c.r = k
n.x = k
n.q = k
n.p = d
n.v = b
k.y = c
m.z = b
m.t = c
assert b.t.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.t: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.r: E = None
        self.txt = txt

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

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

b = A("b")
d = B("d")
c = C("c")
n = D("n")
k = E("k")
m = A("m")

b.z = m
b.t = c
d.o = c
c.o = k
c.r = k
n.x = k
n.q = k
n.p = d
n.v = b
k.y = c
m.z = b
m.t = c
assert b.t.o.y.txt == "c"