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

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

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

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

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

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

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

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

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

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

k.r = e
k.s = i
k.t = b
d.q = e
d.o = k
d.y = b
d.v = i
g.p = b
i.w = g
e.w = b
h.q = i
h.o = k
h.y = b
h.v = e
l.q = e
l.o = k
l.y = b
l.v = i
b.p = g
assert i.w.p.p.p.txt == "b"