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

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

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

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

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

f.x = d
g.o = i
g.u = m
e.v = c
e.o = j
e.u = j
j.x = g
j.o = g
a.x = d
i.x = g
i.o = g
c.x = e
d.v = f
d.o = i
d.u = h
h.x = g
h.o = g
m.x = g
m.o = g
assert d.v.x.v.x.v.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

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

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

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

f.x = d
g.o = i
g.u = m
e.v = c
e.o = j
e.u = j
j.x = g
j.o = g
a.x = d
i.x = g
i.o = g
c.x = e
d.v = f
d.o = i
d.u = h
h.x = g
h.o = g
m.x = g
m.o = g
assert d.v.x.v.x.v.x.u.txt == "h"