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

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

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

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

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

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

a = A("a")
i = B("i")
c = C("c")
h = D("h")
j = E("j")
n = F("n")

a.u = j
i.t = a
i.u = n
i.p = n
i.x = j
c.u = i
c.q = j
h.s = i
h.x = c
j.v = n
j.u = n
n.z = a
assert j.v.z.u.u.z.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

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

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

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

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

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

a = A("a")
i = B("i")
c = C("c")
h = D("h")
j = E("j")
n = F("n")

a.u = j
i.t = a
i.u = n
i.p = n
i.x = j
c.u = i
c.q = j
h.s = i
h.x = c
j.v = n
j.u = n
n.z = a
assert j.v.z.u.u.z.txt == "a"