class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.q: B = None
        self.y: A = None
        self.r: D = None
        self.t: F = None
        self.z: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.q: A = None
        self.t: B = None
        self.u: E = None
        self.r: A = None
        self.txt = txt

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

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

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

m = A("m")
d = B("d")
a = C("a")
k = D("k")
l = E("l")
h = F("h")
c = A("c")

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

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.q: A = None
        self.t: B = None
        self.u: E = None
        self.r: A = None
        self.txt = txt

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

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

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

m = A("m")
d = B("d")
a = C("a")
k = D("k")
l = E("l")
h = F("h")
c = A("c")

m.x = k
m.r = k
m.q = d
m.y = c
m.t = h
m.z = l
d.x = h
a.p = d
a.t = d
a.q = m
a.r = m
a.u = l
k.t = d
k.w = h
l.o = a
l.w = d
l.x = d
h.r = a
h.p = m
c.x = k
c.r = k
c.q = d
c.y = m
c.t = h
c.z = l
assert k.t.x.r.t.x.p.t.txt == "h"