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

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

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

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

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

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

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

i.p = h
i.r = b
i.y = b
i.x = m
e.x = d
e.q = m
h.r = k
h.y = c
h.v = c
h.z = c
m.x = d
m.w = d
c.w = m
c.u = d
c.s = h
c.z = k
c.r = i
n.u = d
n.y = k
n.r = c
n.w = c
d.x = e
d.q = m
k.p = b
k.r = h
k.y = h
k.x = m
l.u = e
l.y = i
l.r = c
l.w = c
b.r = k
b.y = c
b.v = c
b.z = c
assert d.q.x.q.w.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: C = None
        self.x: D = None
        self.y: C = None
        self.txt = txt

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

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

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

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

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

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

i.p = h
i.r = b
i.y = b
i.x = m
e.x = d
e.q = m
h.r = k
h.y = c
h.v = c
h.z = c
m.x = d
m.w = d
c.w = m
c.u = d
c.s = h
c.z = k
c.r = i
n.u = d
n.y = k
n.r = c
n.w = c
d.x = e
d.q = m
k.p = b
k.r = h
k.y = h
k.x = m
l.u = e
l.y = i
l.r = c
l.w = c
b.r = k
b.y = c
b.v = c
b.z = c
assert d.q.x.q.w.x.x.txt == "d"