class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.s: B = None
        self.r: D = None
        self.t: E = None
        self.y: D = None
        self.x: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.u: B = None
        self.txt = txt

d = A("d")
f = B("f")
c = C("c")
k = D("k")
i = E("i")
n = F("n")
b = F("b")
e = E("e")

d.q = k
d.r = k
d.y = k
d.s = f
d.x = f
d.t = e
f.v = d
c.p = n
k.y = f
i.r = d
i.p = k
n.p = c
n.u = f
b.p = c
b.u = f
e.r = d
e.p = k
assert f.v.s.v.t.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.s: B = None
        self.r: D = None
        self.t: E = None
        self.y: D = None
        self.x: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.u: B = None
        self.txt = txt

d = A("d")
f = B("f")
c = C("c")
k = D("k")
i = E("i")
n = F("n")
b = F("b")
e = E("e")

d.q = k
d.r = k
d.y = k
d.s = f
d.x = f
d.t = e
f.v = d
c.p = n
k.y = f
i.r = d
i.p = k
n.p = c
n.u = f
b.p = c
b.u = f
e.r = d
e.p = k
assert f.v.s.v.t.p.y.txt == "f"