class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.t: D = None
        self.o: C = None
        self.s: A = None
        self.y: C = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: E = None
        self.u: A = None
        self.t: A = None
        self.q: A = None
        self.txt = txt

c = A("c")
m = B("m")
f = C("f")
a = D("a")
b = E("b")
d = F("d")
h = A("h")

c.q = f
c.o = f
c.y = f
c.t = a
c.s = h
m.t = f
m.s = a
m.p = a
f.y = m
f.u = h
f.p = d
a.r = f
a.u = m
a.w = m
a.s = d
a.p = b
b.y = h
b.q = f
d.z = b
d.u = c
d.t = c
d.q = c
h.q = f
h.o = f
h.y = f
h.t = a
h.s = c
assert a.p.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.t: D = None
        self.o: C = None
        self.s: A = None
        self.y: C = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: E = None
        self.u: A = None
        self.t: A = None
        self.q: A = None
        self.txt = txt

c = A("c")
m = B("m")
f = C("f")
a = D("a")
b = E("b")
d = F("d")
h = A("h")

c.q = f
c.o = f
c.y = f
c.t = a
c.s = h
m.t = f
m.s = a
m.p = a
f.y = m
f.u = h
f.p = d
a.r = f
a.u = m
a.w = m
a.s = d
a.p = b
b.y = h
b.q = f
d.z = b
d.u = c
d.t = c
d.q = c
h.q = f
h.o = f
h.y = f
h.t = a
h.s = c
assert a.p.q.u.txt == "h"