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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.x: F = None
        self.txt = txt

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

n = A("n")
g = B("g")
k = C("k")
h = D("h")
e = E("e")
i = F("i")

n.x = e
n.p = k
n.o = k
g.s = e
g.z = h
k.q = e
h.x = g
h.v = g
e.t = h
e.x = i
i.q = h
i.t = e
assert n.x.t.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.p: C = None
        self.o: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.x: F = None
        self.txt = txt

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

n = A("n")
g = B("g")
k = C("k")
h = D("h")
e = E("e")
i = F("i")

n.x = e
n.p = k
n.o = k
g.s = e
g.z = h
k.q = e
h.x = g
h.v = g
e.t = h
e.x = i
i.q = h
i.t = e
assert n.x.t.x.txt == "g"