class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.t: C = None
        self.p: D = None
        self.txt = txt

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

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

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

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

l.r = j
l.t = g
l.p = e
m.z = g
g.u = j
g.x = j
g.q = a
g.y = a
e.x = g
e.t = k
k.z = g
b.z = g
j.r = c
j.t = g
j.p = a
a.x = g
a.t = b
c.r = d
c.t = g
c.p = e
d.r = c
d.t = g
d.p = a
assert g.y.t.z.y.t.z.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.t: C = None
        self.p: D = None
        self.txt = txt

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

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

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

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

l.r = j
l.t = g
l.p = e
m.z = g
g.u = j
g.x = j
g.q = a
g.y = a
e.x = g
e.t = k
k.z = g
b.z = g
j.r = c
j.t = g
j.p = a
a.x = g
a.t = b
c.r = d
c.t = g
c.p = e
d.r = c
d.t = g
d.p = a
assert g.y.t.z.y.t.z.u.t.txt == "g"