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

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

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

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

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

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

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

a.x = g
a.q = c
h.p = n
h.w = m
g.t = h
g.o = m
n.x = d
n.z = h
m.v = k
m.o = k
k.x = n
k.p = c
k.w = j
d.x = j
d.q = c
c.x = n
c.p = k
c.w = g
j.t = h
j.o = m
assert h.p.x.q.p.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: F = None
        self.txt = txt

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

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

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

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

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

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

a.x = g
a.q = c
h.p = n
h.w = m
g.t = h
g.o = m
n.x = d
n.z = h
m.v = k
m.o = k
k.x = n
k.p = c
k.w = j
d.x = j
d.q = c
c.x = n
c.p = k
c.w = g
j.t = h
j.o = m
assert h.p.x.q.p.x.txt == "n"