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

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

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

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

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

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

a = A("a")
n = B("n")
e = C("e")
h = D("h")
m = E("m")
l = F("l")

a.q = h
a.x = h
n.q = h
e.s = l
e.x = a
e.t = n
e.v = h
e.q = m
e.r = m
h.w = l
m.p = e
m.o = a
m.s = h
l.p = a
l.s = n
assert e.s.p.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.x: D = None
        self.txt = txt

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

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

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

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

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

a = A("a")
n = B("n")
e = C("e")
h = D("h")
m = E("m")
l = F("l")

a.q = h
a.x = h
n.q = h
e.s = l
e.x = a
e.t = n
e.v = h
e.q = m
e.r = m
h.w = l
m.p = e
m.o = a
m.s = h
l.p = a
l.s = n
assert e.s.p.q.txt == "h"