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

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

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

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

g = A("g")
e = B("e")
j = C("j")
d = D("d")
a = D("a")
f = B("f")
n = D("n")
k = D("k")
c = C("c")
l = B("l")

g.t = e
g.s = c
e.s = l
e.v = c
e.x = c
e.p = f
j.t = g
j.y = g
j.q = c
d.u = g
d.z = k
a.u = g
a.z = k
f.s = l
f.v = c
f.x = c
f.p = e
n.u = g
n.z = k
k.u = g
k.z = a
c.t = g
c.y = g
c.q = j
l.s = f
l.p = f
l.v = j
l.x = j
assert a.u.t.s.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: C = None
        self.txt = txt

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

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

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

g = A("g")
e = B("e")
j = C("j")
d = D("d")
a = D("a")
f = B("f")
n = D("n")
k = D("k")
c = C("c")
l = B("l")

g.t = e
g.s = c
e.s = l
e.v = c
e.x = c
e.p = f
j.t = g
j.y = g
j.q = c
d.u = g
d.z = k
a.u = g
a.z = k
f.s = l
f.v = c
f.x = c
f.p = e
n.u = g
n.z = k
k.u = g
k.z = a
c.t = g
c.y = g
c.q = j
l.s = f
l.p = f
l.v = j
l.x = j
assert a.u.t.s.p.v.txt == "c"