class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.o: E = None
        self.y: C = None
        self.v: B = None
        self.p: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: F = None
        self.p: A = None
        self.v: A = None
        self.w: C = None
        self.y: F = None
        self.r: C = None
        self.txt = txt

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.o: F = None
        self.p: A = None
        self.v: A = None
        self.w: C = None
        self.y: F = None
        self.r: C = None
        self.txt = txt

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

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

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

g.x = c
g.o = c
g.y = m
g.p = m
g.v = n
n.t = m
m.w = n
m.y = l
b.o = l
b.y = l
b.p = g
b.v = g
b.w = m
b.r = m
c.z = b
l.q = m
assert m.w.t.w.t.txt == "m"