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

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

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.x: A = None
        self.t: E = None
        self.q: C = None
        self.p: B = 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.q: D = None
        self.x: A = None
        self.s: E = None
        self.y: E = None
        self.txt = txt

h = A("h")
m = B("m")
f = C("f")
e = D("e")
d = E("d")
i = F("i")
n = A("n")
g = C("g")

h.u = i
h.x = i
m.q = d
m.x = g
f.p = d
e.o = f
e.x = h
e.t = d
e.q = g
e.p = m
d.y = g
i.q = e
i.x = n
i.s = d
i.y = d
n.u = i
n.x = i
g.p = d
assert i.x.x.q.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.u: F = None
        self.x: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.x: A = None
        self.t: E = None
        self.q: C = None
        self.p: B = 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.q: D = None
        self.x: A = None
        self.s: E = None
        self.y: E = None
        self.txt = txt

h = A("h")
m = B("m")
f = C("f")
e = D("e")
d = E("d")
i = F("i")
n = A("n")
g = C("g")

h.u = i
h.x = i
m.q = d
m.x = g
f.p = d
e.o = f
e.x = h
e.t = d
e.q = g
e.p = m
d.y = g
i.q = e
i.x = n
i.s = d
i.y = d
n.u = i
n.x = i
g.p = d
assert i.x.x.q.t.y.txt == "g"