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

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

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

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

m = A("m")
h = B("h")
k = C("k")
f = D("f")
j = B("j")
c = C("c")
b = C("b")
n = A("n")
g = C("g")

m.t = f
h.u = n
h.o = f
h.v = f
h.t = m
k.o = h
f.u = g
j.u = n
j.o = f
j.v = f
j.t = m
c.o = h
b.o = j
n.t = f
g.o = j
assert f.u.o.u.t.u.o.t.t.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

m = A("m")
h = B("h")
k = C("k")
f = D("f")
j = B("j")
c = C("c")
b = C("b")
n = A("n")
g = C("g")

m.t = f
h.u = n
h.o = f
h.v = f
h.t = m
k.o = h
f.u = g
j.u = n
j.o = f
j.v = f
j.t = m
c.o = h
b.o = j
n.t = f
g.o = j
assert f.u.o.u.t.u.o.t.t.u.txt == "g"