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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: E = None
        self.p: D = None
        self.s: C = None
        self.w: B = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: E = None
        self.p: D = None
        self.s: C = None
        self.w: B = None
        self.txt = txt

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

n.u = l
a.u = j
a.v = e
a.x = e
e.q = a
l.o = h
j.x = n
h.z = a
h.w = a
h.o = j
h.p = l
h.s = e
assert l.o.o.x.txt == "n"