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

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

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

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.s: F = None
        self.u: F = None
        self.r: C = None
        self.x: C = None
        self.txt = txt

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

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

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

j.p = n
j.z = g
h.w = g
h.r = c
i.v = h
i.r = g
i.p = g
i.u = n
c.w = n
c.s = n
c.u = n
c.r = i
c.x = i
g.z = i
g.s = n
g.w = h
n.x = g
n.p = i
l.p = n
l.z = g
assert n.x.s.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.z: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.s: F = None
        self.u: F = None
        self.r: C = None
        self.x: C = None
        self.txt = txt

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

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

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

j.p = n
j.z = g
h.w = g
h.r = c
i.v = h
i.r = g
i.p = g
i.u = n
c.w = n
c.s = n
c.u = n
c.r = i
c.x = i
g.z = i
g.s = n
g.w = h
n.x = g
n.p = i
l.p = n
l.z = g
assert n.x.s.p.txt == "i"