class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.q: D = None
        self.x: C = None
        self.t: D = None
        self.txt = txt

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

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

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

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

c.z = a
c.q = n
c.x = l
c.t = d
b.w = a
l.w = d
n.q = b
n.v = d
g.z = b
g.q = d
g.x = l
g.t = n
f.w = a
d.q = a
d.v = n
a.w = f
assert a.w.w.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.q: D = None
        self.x: C = None
        self.t: D = None
        self.txt = txt

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

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

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

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

c.z = a
c.q = n
c.x = l
c.t = d
b.w = a
l.w = d
n.q = b
n.v = d
g.z = b
g.q = d
g.x = l
g.t = n
f.w = a
d.q = a
d.v = n
a.w = f
assert a.w.w.w.w.w.w.txt == "a"