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

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

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.p: B = None
        self.y: D = None
        self.txt = txt

e = A("e")
h = B("h")
k = C("k")
n = D("n")
i = B("i")
g = B("g")
b = A("b")
d = D("d")

e.o = b
h.o = b
h.x = b
h.y = i
k.v = b
k.p = i
n.q = e
n.p = h
n.y = d
i.o = e
i.x = e
i.y = g
g.o = b
g.y = h
g.x = e
b.o = e
d.q = b
d.p = i
d.y = n
assert b.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.o: A = None
        self.y: B = None
        self.x: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.p: B = None
        self.y: D = None
        self.txt = txt

e = A("e")
h = B("h")
k = C("k")
n = D("n")
i = B("i")
g = B("g")
b = A("b")
d = D("d")

e.o = b
h.o = b
h.x = b
h.y = i
k.v = b
k.p = i
n.q = e
n.p = h
n.y = d
i.o = e
i.x = e
i.y = g
g.o = b
g.y = h
g.x = e
b.o = e
d.q = b
d.p = i
d.y = n
assert b.o.o.o.o.o.txt == "e"