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

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.u: B = None
        self.r: B = None
        self.t: C = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.u: B = None
        self.r: B = None
        self.t: C = None
        self.txt = txt

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

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

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

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