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

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

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

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

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

i.o = g
k.u = h
k.r = n
k.o = e
n.t = h
n.w = f
l.r = f
l.x = g
h.o = f
g.o = i
f.o = h
e.t = h
e.w = i
assert l.x.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.u: A = None
        self.r: C = None
        self.o: C = None
        self.txt = txt

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

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

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

i.o = g
k.u = h
k.r = n
k.o = e
n.t = h
n.w = f
l.r = f
l.x = g
h.o = f
g.o = i
f.o = h
e.t = h
e.w = i
assert l.x.o.o.o.o.o.o.txt == "g"