class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.r: E = None
        self.q: E = None
        self.txt = txt

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

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

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

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

k = A("k")
m = B("m")
f = C("f")
c = D("c")
e = E("e")
l = A("l")

k.t = l
k.r = e
k.q = e
m.s = e
m.t = k
f.y = m
f.w = m
f.o = e
c.t = l
e.p = f
e.z = l
l.t = k
l.r = e
l.q = e
assert c.t.t.t.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.r: E = None
        self.q: E = None
        self.txt = txt

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

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

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

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

k = A("k")
m = B("m")
f = C("f")
c = D("c")
e = E("e")
l = A("l")

k.t = l
k.r = e
k.q = e
m.s = e
m.t = k
f.y = m
f.w = m
f.o = e
c.t = l
e.p = f
e.z = l
l.t = k
l.r = e
l.q = e
assert c.t.t.t.r.txt == "e"