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

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

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

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

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

f.u = n
f.q = k
f.t = g
h.s = j
k.t = d
k.r = d
n.o = f
j.o = f
e.s = b
g.u = b
g.q = k
g.t = f
a.s = j
b.o = f
d.t = k
d.r = k
assert d.t.t.r.t.r.t.r.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.q: C = None
        self.t: A = None
        self.txt = txt

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

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

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

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

f.u = n
f.q = k
f.t = g
h.s = j
k.t = d
k.r = d
n.o = f
j.o = f
e.s = b
g.u = b
g.q = k
g.t = f
a.s = j
b.o = f
d.t = k
d.r = k
assert d.t.t.r.t.r.t.r.t.t.txt == "k"