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

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

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

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

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

c = A("c")
j = B("j")
e = C("e")
b = D("b")
d = E("d")
k = B("k")

c.w = b
c.u = b
c.t = e
j.p = d
e.u = b
e.w = d
b.t = d
d.o = c
d.y = c
d.q = e
k.p = d
assert c.u.t.q.u.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.u: D = None
        self.t: C = None
        self.txt = txt

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

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

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

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

c = A("c")
j = B("j")
e = C("e")
b = D("b")
d = E("d")
k = B("k")

c.w = b
c.u = b
c.t = e
j.p = d
e.u = b
e.w = d
b.t = d
d.o = c
d.y = c
d.q = e
k.p = d
assert c.u.t.q.u.t.o.txt == "c"