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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.o: F = None
        self.v: C = None
        self.r: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: A = None
        self.r: D = 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.z: F = None
        self.txt = txt

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

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

l.x = e
e.y = g
e.o = j
e.v = k
e.r = k
k.y = e
k.z = l
k.r = g
g.p = k
n.z = j
j.p = e
j.s = l
j.z = n
j.x = g
j.q = k
h.z = j
assert g.p.z.x.y.p.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.o: F = None
        self.v: C = None
        self.r: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: A = None
        self.r: D = 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.z: F = None
        self.txt = txt

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

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

l.x = e
e.y = g
e.o = j
e.v = k
e.r = k
k.y = e
k.z = l
k.r = g
g.p = k
n.z = j
j.p = e
j.s = l
j.z = n
j.x = g
j.q = k
h.z = j
assert g.p.z.x.y.p.r.p.txt == "k"