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

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

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

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

l = A("l")
n = B("n")
c = C("c")
b = D("b")
i = D("i")
d = D("d")
f = B("f")

l.y = c
n.s = f
c.w = l
c.p = l
c.x = l
c.t = i
b.z = c
b.r = c
b.t = i
i.z = c
i.r = c
i.t = b
d.z = c
d.r = c
d.t = i
f.s = n
assert b.r.t.z.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

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

l = A("l")
n = B("n")
c = C("c")
b = D("b")
i = D("i")
d = D("d")
f = B("f")

l.y = c
n.s = f
c.w = l
c.p = l
c.x = l
c.t = i
b.z = c
b.r = c
b.t = i
i.z = c
i.r = c
i.t = b
d.z = c
d.r = c
d.t = i
f.s = n
assert b.r.t.z.t.t.t.t.txt == "b"