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

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.o: D = None
        self.v: E = None
        self.s: E = None
        self.txt = txt

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.o: D = None
        self.v: E = None
        self.s: E = None
        self.txt = txt

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

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

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

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

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

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