class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.x: C = None
        self.y: B = None
        self.t: E = None
        self.v: B = 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: C = None
        self.x: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: D = None
        self.w: A = None
        self.z: C = None
        self.q: B = None
        self.txt = txt

c = A("c")
g = B("g")
l = C("l")
m = D("m")
n = E("n")
d = B("d")
e = C("e")
i = C("i")
j = E("j")

c.p = l
c.x = l
c.y = g
c.v = g
c.t = j
g.p = n
l.u = e
l.x = m
m.v = l
n.r = e
n.x = m
n.w = c
n.z = l
n.q = d
d.p = n
e.u = l
e.x = m
i.u = l
i.x = m
j.r = i
j.x = m
j.w = c
j.z = l
j.q = g
assert i.u.u.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.x: C = None
        self.y: B = None
        self.t: E = None
        self.v: B = 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: C = None
        self.x: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: D = None
        self.w: A = None
        self.z: C = None
        self.q: B = None
        self.txt = txt

c = A("c")
g = B("g")
l = C("l")
m = D("m")
n = E("n")
d = B("d")
e = C("e")
i = C("i")
j = E("j")

c.p = l
c.x = l
c.y = g
c.v = g
c.t = j
g.p = n
l.u = e
l.x = m
m.v = l
n.r = e
n.x = m
n.w = c
n.z = l
n.q = d
d.p = n
e.u = l
e.x = m
i.u = l
i.x = m
j.r = i
j.x = m
j.w = c
j.z = l
j.q = g
assert i.u.u.u.x.txt == "m"