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

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

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

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

i = A("i")
f = B("f")
a = C("a")
h = D("h")
b = A("b")
c = D("c")
l = D("l")
e = B("e")
g = B("g")
k = D("k")

i.o = a
i.r = c
f.s = k
a.x = f
a.y = f
a.q = g
a.t = g
h.y = l
h.x = k
b.o = a
b.r = l
c.y = h
c.x = h
l.y = k
l.x = k
e.s = k
g.s = k
k.y = h
k.x = h
assert b.o.q.s.x.x.y.x.x.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.r: D = None
        self.txt = txt

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

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

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

i = A("i")
f = B("f")
a = C("a")
h = D("h")
b = A("b")
c = D("c")
l = D("l")
e = B("e")
g = B("g")
k = D("k")

i.o = a
i.r = c
f.s = k
a.x = f
a.y = f
a.q = g
a.t = g
h.y = l
h.x = k
b.o = a
b.r = l
c.y = h
c.x = h
l.y = k
l.x = k
e.s = k
g.s = k
k.y = h
k.x = h
assert b.o.q.s.x.x.y.x.x.y.x.txt == "k"