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

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

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

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

c = A("c")
k = B("k")
m = C("m")
d = D("d")
j = A("j")
f = A("f")
g = C("g")
a = A("a")
i = B("i")
h = D("h")

c.u = a
k.t = h
k.z = c
k.p = d
m.p = i
m.s = i
d.u = a
d.v = h
d.r = h
d.q = m
j.u = c
f.u = j
g.p = i
g.s = i
a.u = j
i.t = h
i.z = j
i.p = d
h.u = a
h.v = d
h.r = d
h.q = m
assert d.r.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

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

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

c = A("c")
k = B("k")
m = C("m")
d = D("d")
j = A("j")
f = A("f")
g = C("g")
a = A("a")
i = B("i")
h = D("h")

c.u = a
k.t = h
k.z = c
k.p = d
m.p = i
m.s = i
d.u = a
d.v = h
d.r = h
d.q = m
j.u = c
f.u = j
g.p = i
g.s = i
a.u = j
i.t = h
i.z = j
i.p = d
h.u = a
h.v = d
h.r = d
h.q = m
assert d.r.u.u.u.u.txt == "a"