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

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: A = None
        self.txt = txt

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

l = A("l")
g = B("g")
e = C("e")
i = D("i")
m = B("m")
k = D("k")
n = D("n")
h = A("h")

l.o = h
g.t = h
g.w = h
g.z = k
e.p = g
e.v = h
i.t = l
m.t = h
m.z = i
m.w = l
k.t = h
n.t = h
h.o = l
assert i.t.o.o.o.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: A = None
        self.txt = txt

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

l = A("l")
g = B("g")
e = C("e")
i = D("i")
m = B("m")
k = D("k")
n = D("n")
h = A("h")

l.o = h
g.t = h
g.w = h
g.z = k
e.p = g
e.v = h
i.t = l
m.t = h
m.z = i
m.w = l
k.t = h
n.t = h
h.o = l
assert i.t.o.o.o.o.o.o.o.txt == "h"