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

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

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

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.w: F = None
        self.y: F = None
        self.txt = txt

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

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

l = A("l")
f = B("f")
m = C("m")
n = D("n")
j = E("j")
b = F("b")
c = E("c")
e = F("e")
d = A("d")
g = A("g")

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

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

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

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.w: F = None
        self.y: F = None
        self.txt = txt

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

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

l = A("l")
f = B("f")
m = C("m")
n = D("n")
j = E("j")
b = F("b")
c = E("c")
e = F("e")
d = A("d")
g = A("g")

l.t = d
l.q = m
f.w = j
m.p = g
n.x = b
n.w = e
n.y = e
j.z = f
j.p = f
j.r = g
j.q = n
j.w = m
j.t = m
b.t = m
b.q = e
b.s = e
b.u = j
c.z = f
c.p = f
c.r = g
c.q = n
c.w = m
c.t = m
e.t = m
e.q = b
e.s = b
e.u = j
d.t = l
d.q = m
g.t = d
g.q = m
assert n.w.s.t.p.q.p.q.txt == "m"