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

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.p: E = None
        self.z: E = None
        self.w: A = None
        self.t: E = None
        self.txt = txt

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

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

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

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

g.q = n
c.v = e
c.p = b
c.z = b
c.w = j
c.t = l
i.u = n
n.p = c
b.r = c
e.q = n
f.u = n
j.q = n
l.r = c
assert l.r.v.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.p: E = None
        self.z: E = None
        self.w: A = None
        self.t: E = None
        self.txt = txt

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

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

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

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

g.q = n
c.v = e
c.p = b
c.z = b
c.w = j
c.t = l
i.u = n
n.p = c
b.r = c
e.q = n
f.u = n
j.q = n
l.r = c
assert l.r.v.q.p.txt == "c"