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

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

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

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

k = A("k")
h = B("h")
b = C("b")
l = D("l")
f = D("f")
j = D("j")
d = C("d")
e = B("e")
i = C("i")

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

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

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

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

k = A("k")
h = B("h")
b = C("b")
l = D("l")
f = D("f")
j = D("j")
d = C("d")
e = B("e")
i = C("i")

k.t = l
k.r = l
k.p = d
k.s = f
h.o = i
b.w = k
b.x = k
b.u = d
l.v = k
l.t = k
l.s = i
f.v = k
f.t = k
f.s = b
j.v = k
j.t = k
j.s = b
d.w = k
d.x = k
d.u = b
e.o = b
i.w = k
i.x = k
i.u = d
assert f.s.u.w.p.u.u.u.w.p.txt == "d"