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

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

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

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

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

k.t = j
k.q = b
k.w = c
k.p = l
b.o = j
f.x = b
f.o = j
j.r = c
j.s = l
d.t = j
d.q = b
d.w = c
d.p = c
c.t = j
c.q = b
c.w = l
c.p = d
l.t = j
l.q = b
l.w = d
l.p = k
h.x = b
h.o = j
assert c.q.o.s.p.t.s.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.q: B = None
        self.w: A = None
        self.p: A = None
        self.txt = txt

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

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

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

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

k.t = j
k.q = b
k.w = c
k.p = l
b.o = j
f.x = b
f.o = j
j.r = c
j.s = l
d.t = j
d.q = b
d.w = c
d.p = c
c.t = j
c.q = b
c.w = l
c.p = d
l.t = j
l.q = b
l.w = d
l.p = k
h.x = b
h.o = j
assert c.q.o.s.p.t.s.w.q.txt == "b"