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

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

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

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

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

l = A("l")
k = B("k")
n = C("n")
h = D("h")
b = E("b")
c = D("c")

l.t = b
k.z = n
k.v = c
k.o = h
k.q = l
n.x = k
h.u = n
h.p = n
h.o = c
h.q = k
h.t = k
b.s = h
b.p = h
b.y = l
b.z = c
c.u = n
c.p = n
c.o = h
c.q = k
c.t = k
assert n.x.q.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

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

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

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

l = A("l")
k = B("k")
n = C("n")
h = D("h")
b = E("b")
c = D("c")

l.t = b
k.z = n
k.v = c
k.o = h
k.q = l
n.x = k
h.u = n
h.p = n
h.o = c
h.q = k
h.t = k
b.s = h
b.p = h
b.y = l
b.z = c
c.u = n
c.p = n
c.o = h
c.q = k
c.t = k
assert n.x.q.t.y.txt == "l"