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

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.y: A = None
        self.z: C = None
        self.t: D = None
        self.p: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.y: E = None
        self.t: C = None
        self.txt = txt

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

a = A("a")
g = B("g")
l = C("l")
m = D("m")
i = E("i")
c = F("c")
n = A("n")
b = D("b")
d = E("d")

a.w = n
a.x = c
a.v = l
a.t = b
g.u = m
g.t = m
g.y = n
g.z = l
g.p = i
l.z = c
m.v = b
i.q = g
i.y = d
i.t = l
c.q = l
n.w = a
n.x = c
n.v = l
n.t = b
b.v = m
d.q = g
d.y = i
d.t = l
assert l.z.q.z.q.z.q.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.x: F = None
        self.v: C = None
        self.t: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.y: A = None
        self.z: C = None
        self.t: D = None
        self.p: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.y: E = None
        self.t: C = None
        self.txt = txt

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

a = A("a")
g = B("g")
l = C("l")
m = D("m")
i = E("i")
c = F("c")
n = A("n")
b = D("b")
d = E("d")

a.w = n
a.x = c
a.v = l
a.t = b
g.u = m
g.t = m
g.y = n
g.z = l
g.p = i
l.z = c
m.v = b
i.q = g
i.y = d
i.t = l
c.q = l
n.w = a
n.x = c
n.v = l
n.t = b
b.v = m
d.q = g
d.y = i
d.t = l
assert l.z.q.z.q.z.q.z.q.txt == "l"