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

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

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

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

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

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

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

a.w = g
n.p = g
n.t = a
m.t = n
i.p = n
i.y = m
i.o = k
c.u = j
c.x = k
c.p = a
c.y = m
c.z = l
j.x = n
j.t = m
j.r = k
j.u = l
j.v = a
k.x = n
k.t = m
k.r = j
k.u = i
k.v = a
l.p = n
l.y = m
l.o = k
g.u = k
g.x = k
g.p = a
g.y = m
g.z = l
assert g.p.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

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

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

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

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

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

a.w = g
n.p = g
n.t = a
m.t = n
i.p = n
i.y = m
i.o = k
c.u = j
c.x = k
c.p = a
c.y = m
c.z = l
j.x = n
j.t = m
j.r = k
j.u = l
j.v = a
k.x = n
k.t = m
k.r = j
k.u = i
k.v = a
l.p = n
l.y = m
l.o = k
g.u = k
g.x = k
g.p = a
g.y = m
g.z = l
assert g.p.w.p.txt == "a"