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

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

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

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

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

d.v = f
d.t = a
b.t = e
i.s = f
i.o = d
i.u = h
h.y = k
h.o = c
e.s = h
e.u = h
e.o = a
f.y = h
f.o = c
g.v = h
g.t = d
c.s = f
c.u = f
c.o = d
a.v = k
a.t = g
k.y = h
k.o = i
assert b.t.u.o.u.o.o.v.o.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.t: A = None
        self.txt = txt

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

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

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

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

d.v = f
d.t = a
b.t = e
i.s = f
i.o = d
i.u = h
h.y = k
h.o = c
e.s = h
e.u = h
e.o = a
f.y = h
f.o = c
g.v = h
g.t = d
c.s = f
c.u = f
c.o = d
a.v = k
a.t = g
k.y = h
k.o = i
assert b.t.u.o.u.o.o.v.o.o.v.txt == "f"