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

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

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

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

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

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

a = A("a")
m = B("m")
k = C("k")
h = D("h")
c = E("c")
f = F("f")
l = E("l")
g = B("g")

a.u = k
a.p = m
m.v = h
m.x = h
m.r = k
m.t = f
m.w = l
m.p = a
k.x = h
h.w = k
c.w = l
c.z = l
c.r = a
c.q = g
c.o = h
f.y = a
l.w = c
l.z = c
l.r = a
l.q = g
l.o = h
g.v = h
g.x = h
g.r = k
g.t = f
g.w = c
g.p = a
assert g.w.w.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.p: B = None
        self.txt = txt

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

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

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

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

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

a = A("a")
m = B("m")
k = C("k")
h = D("h")
c = E("c")
f = F("f")
l = E("l")
g = B("g")

a.u = k
a.p = m
m.v = h
m.x = h
m.r = k
m.t = f
m.w = l
m.p = a
k.x = h
h.w = k
c.w = l
c.z = l
c.r = a
c.q = g
c.o = h
f.y = a
l.w = c
l.z = c
l.r = a
l.q = g
l.o = h
g.v = h
g.x = h
g.r = k
g.t = f
g.w = c
g.p = a
assert g.w.w.w.r.txt == "a"