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

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

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

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

l = A("l")
i = B("i")
d = C("d")
j = D("j")
e = A("e")
g = B("g")
h = D("h")

l.x = i
i.y = d
i.s = d
d.v = j
j.y = i
j.u = i
j.o = d
e.x = i
g.y = d
g.s = d
h.y = g
h.u = g
h.o = d
assert h.o.v.o.v.o.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

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

l = A("l")
i = B("i")
d = C("d")
j = D("j")
e = A("e")
g = B("g")
h = D("h")

l.x = i
i.y = d
i.s = d
d.v = j
j.y = i
j.u = i
j.o = d
e.x = i
g.y = d
g.s = d
h.y = g
h.u = g
h.o = d
assert h.o.v.o.v.o.v.u.txt == "i"