class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.q: F = None
        self.v: C = None
        self.z: B = None
        self.y: C = None
        self.txt = txt

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

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

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

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

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

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

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

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

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

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

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

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

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

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