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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: B = None
        self.v: A = None
        self.txt = txt

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

e.p = n
e.x = n
e.t = n
e.u = d
g.u = e
n.p = e
d.x = h
j.p = i
h.p = g
h.w = g
h.v = e
i.p = e
f.x = h
assert f.x.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.u: D = None
        self.x: C = None
        self.t: C = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: B = None
        self.v: A = None
        self.txt = txt

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

e.p = n
e.x = n
e.t = n
e.u = d
g.u = e
n.p = e
d.x = h
j.p = i
h.p = g
h.w = g
h.v = e
i.p = e
f.x = h
assert f.x.v.t.txt == "n"