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

class B:
    def __init__(self, txt: str):
        self.x: F = None
        self.r: E = None
        self.q: C = None
        self.z: E = None
        self.s: E = None
        self.w: E = None
        self.txt = txt

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

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

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

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

h = A("h")
e = B("e")
m = C("m")
c = D("c")
n = E("n")
d = F("d")

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

class B:
    def __init__(self, txt: str):
        self.x: F = None
        self.r: E = None
        self.q: C = None
        self.z: E = None
        self.s: E = None
        self.w: E = None
        self.txt = txt

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

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

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

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

h = A("h")
e = B("e")
m = C("m")
c = D("c")
n = E("n")
d = F("d")

h.q = e
h.x = n
h.y = d
h.t = m
e.x = d
e.r = n
e.z = n
e.s = n
e.w = n
e.q = m
m.z = n
m.y = d
c.o = n
c.w = e
n.u = d
n.w = d
n.x = e
n.t = h
n.p = h
n.s = m
d.t = m
d.r = m
d.q = c
assert c.o.x.x.txt == "d"