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

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

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

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

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

i.t = g
i.y = d
i.w = a
i.p = c
m.v = a
g.p = e
g.o = a
g.y = k
c.u = e
c.s = d
c.r = b
c.x = a
a.t = d
a.y = g
a.w = i
a.p = c
f.v = i
e.v = a
b.u = k
b.s = g
b.r = c
b.x = a
d.p = k
d.o = a
d.y = m
k.v = a
assert d.o.t.o.t.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.y: C = None
        self.w: A = None
        self.p: D = None
        self.txt = txt

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

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

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

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

i.t = g
i.y = d
i.w = a
i.p = c
m.v = a
g.p = e
g.o = a
g.y = k
c.u = e
c.s = d
c.r = b
c.x = a
a.t = d
a.y = g
a.w = i
a.p = c
f.v = i
e.v = a
b.u = k
b.s = g
b.r = c
b.x = a
d.p = k
d.o = a
d.y = m
k.v = a
assert d.o.t.o.t.y.v.txt == "a"