class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.y: D = None
        self.v: D = None
        self.x: F = 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: D = None
        self.q: A = None
        self.p: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: B = None
        self.x: A = None
        self.u: D = None
        self.v: A = None
        self.txt = txt

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

k.q = l
k.y = b
k.v = b
k.x = h
l.y = e
c.z = b
c.q = k
c.p = e
b.s = l
e.q = c
h.y = b
h.u = b
h.z = l
h.x = k
h.v = k
assert l.y.q.p.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.y: D = None
        self.v: D = None
        self.x: F = 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: D = None
        self.q: A = None
        self.p: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: B = None
        self.x: A = None
        self.u: D = None
        self.v: A = None
        self.txt = txt

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

k.q = l
k.y = b
k.v = b
k.x = h
l.y = e
c.z = b
c.q = k
c.p = e
b.s = l
e.q = c
h.y = b
h.u = b
h.z = l
h.x = k
h.v = k
assert l.y.q.p.q.txt == "c"