class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: D = None
        self.v: C = None
        self.r: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.q: D = None
        self.o: C = None
        self.t: A = None
        self.txt = txt

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

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

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

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

l = A("l")
d = B("d")
a = C("a")
k = D("k")
n = E("n")
h = F("h")

l.q = k
l.p = k
l.v = a
l.r = h
d.u = l
d.t = l
d.q = k
d.o = a
a.q = d
k.q = h
k.t = a
n.r = l
n.p = l
n.x = l
n.v = a
n.u = a
h.s = a
h.v = a
h.w = d
assert a.q.u.r.v.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: D = None
        self.v: C = None
        self.r: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.q: D = None
        self.o: C = None
        self.t: A = None
        self.txt = txt

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

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

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

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

l = A("l")
d = B("d")
a = C("a")
k = D("k")
n = E("n")
h = F("h")

l.q = k
l.p = k
l.v = a
l.r = h
d.u = l
d.t = l
d.q = k
d.o = a
a.q = d
k.q = h
k.t = a
n.r = l
n.p = l
n.x = l
n.v = a
n.u = a
h.s = a
h.v = a
h.w = d
assert a.q.u.r.v.q.txt == "d"