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

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

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.u: A = None
        self.z: A = None
        self.s: F = None
        self.txt = txt

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

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

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

c = A("c")
a = B("a")
e = C("e")
j = D("j")
k = E("k")
l = F("l")
h = E("h")

c.q = e
a.q = j
a.r = e
e.v = h
e.u = c
e.z = c
e.s = l
j.x = a
j.r = h
k.y = a
k.x = l
k.q = h
l.x = k
h.y = a
h.x = l
h.q = k
assert c.q.s.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.u: A = None
        self.z: A = None
        self.s: F = None
        self.txt = txt

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

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

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

c = A("c")
a = B("a")
e = C("e")
j = D("j")
k = E("k")
l = F("l")
h = E("h")

c.q = e
a.q = j
a.r = e
e.v = h
e.u = c
e.z = c
e.s = l
j.x = a
j.r = h
k.y = a
k.x = l
k.q = h
l.x = k
h.y = a
h.x = l
h.q = k
assert c.q.s.x.txt == "k"