class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.w: E = None
        self.t: C = None
        self.s: F = None
        self.o: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: F = None
        self.s: A = None
        self.t: F = None
        self.z: D = None
        self.q: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: F = None
        self.x: F = 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.y: C = None
        self.t: B = None
        self.u: D = None
        self.o: B = None
        self.txt = txt

m = A("m")
a = B("a")
i = C("i")
k = D("k")
j = E("j")
c = F("c")

m.p = c
m.s = c
m.w = j
m.t = i
m.o = k
a.o = c
a.t = c
a.s = m
a.q = m
a.z = k
i.q = k
k.r = c
k.x = c
j.y = i
c.y = i
c.t = a
c.o = a
c.u = k
assert m.p.u.r.y.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.w: E = None
        self.t: C = None
        self.s: F = None
        self.o: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: F = None
        self.s: A = None
        self.t: F = None
        self.z: D = None
        self.q: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: F = None
        self.x: F = 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.y: C = None
        self.t: B = None
        self.u: D = None
        self.o: B = None
        self.txt = txt

m = A("m")
a = B("a")
i = C("i")
k = D("k")
j = E("j")
c = F("c")

m.p = c
m.s = c
m.w = j
m.t = i
m.o = k
a.o = c
a.t = c
a.s = m
a.q = m
a.z = k
i.q = k
k.r = c
k.x = c
j.y = i
c.y = i
c.t = a
c.o = a
c.u = k
assert m.p.u.r.y.q.r.txt == "c"