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

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

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

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

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

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

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

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

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

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

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

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

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

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

m.q = n
m.r = i
m.z = l
l.p = i
l.v = i
l.s = c
l.x = n
l.t = m
n.w = i
f.y = n
i.y = n
c.r = i
c.y = l
d.q = n
d.r = i
d.z = l
e.y = n
assert i.y.w.y.w.txt == "i"