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

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.y: A = None
        self.s: A = None
        self.txt = txt

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

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

k = A("k")
i = B("i")
f = C("f")
h = D("h")
l = E("l")
g = F("g")

k.p = l
k.y = h
k.z = h
i.y = l
f.z = l
f.s = h
h.v = l
h.y = k
h.s = k
l.u = g
l.w = g
l.z = h
g.z = h
g.q = h
assert l.z.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.y: D = None
        self.z: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.y: A = None
        self.s: A = None
        self.txt = txt

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

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

k = A("k")
i = B("i")
f = C("f")
h = D("h")
l = E("l")
g = F("g")

k.p = l
k.y = h
k.z = h
i.y = l
f.z = l
f.s = h
h.v = l
h.y = k
h.s = k
l.u = g
l.w = g
l.z = h
g.z = h
g.q = h
assert l.z.v.z.txt == "h"