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

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

class C:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

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

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

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

e = A("e")
n = B("n")
f = C("f")
d = D("d")
l = E("l")
m = F("m")
j = E("j")

e.p = d
e.x = j
n.z = f
f.y = m
d.p = f
l.x = e
l.s = d
l.p = f
l.u = m
m.u = f
j.x = e
j.s = d
j.p = f
j.u = m
assert j.p.y.u.y.u.y.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.x: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

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

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

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

e = A("e")
n = B("n")
f = C("f")
d = D("d")
l = E("l")
m = F("m")
j = E("j")

e.p = d
e.x = j
n.z = f
f.y = m
d.p = f
l.x = e
l.s = d
l.p = f
l.u = m
m.u = f
j.x = e
j.s = d
j.p = f
j.u = m
assert j.p.y.u.y.u.y.u.txt == "f"