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

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

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.p: D = None
        self.u: D = None
        self.t: B = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.p: D = None
        self.u: D = None
        self.t: B = None
        self.txt = txt

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

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