class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.p: C = None
        self.v: B = None
        self.t: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: C = None
        self.y: B = None
        self.z: B = None
        self.txt = txt

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

g = A("g")
c = B("c")
a = C("a")
d = D("d")
b = C("b")
n = A("n")
i = D("i")
e = A("e")

g.u = n
g.t = n
g.p = b
g.v = c
c.o = i
c.t = g
a.u = b
a.y = c
a.z = c
d.q = c
d.w = c
d.r = g
b.u = a
b.y = c
b.z = c
n.u = e
n.t = e
n.p = b
n.v = c
i.q = c
i.w = c
i.r = g
e.u = g
e.p = a
e.v = c
e.t = n
assert b.z.o.r.u.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.p: C = None
        self.v: B = None
        self.t: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: C = None
        self.y: B = None
        self.z: B = None
        self.txt = txt

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

g = A("g")
c = B("c")
a = C("a")
d = D("d")
b = C("b")
n = A("n")
i = D("i")
e = A("e")

g.u = n
g.t = n
g.p = b
g.v = c
c.o = i
c.t = g
a.u = b
a.y = c
a.z = c
d.q = c
d.w = c
d.r = g
b.u = a
b.y = c
b.z = c
n.u = e
n.t = e
n.p = b
n.v = c
i.q = c
i.w = c
i.r = g
e.u = g
e.p = a
e.v = c
e.t = n
assert b.z.o.r.u.p.u.txt == "a"