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

class B:
    def __init__(self, txt: str):
        self.t: F = None
        self.v: E = None
        self.q: C = None
        self.w: E = None
        self.y: A = None
        self.s: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.t: B = None
        self.q: F = None
        self.x: F = None
        self.o: F = None
        self.txt = txt

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

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

b = A("b")
c = B("c")
d = C("d")
k = D("k")
f = E("f")
a = F("a")
j = E("j")
h = A("h")

b.q = c
b.p = a
b.t = d
b.w = d
b.z = k
b.v = f
c.t = a
c.s = a
c.v = j
c.w = j
c.q = d
c.y = b
d.p = f
d.s = k
d.u = c
k.r = c
k.t = c
k.q = a
k.x = a
k.o = a
f.v = b
f.r = h
f.q = h
a.p = d
j.v = h
j.r = h
j.q = h
h.q = c
h.p = a
h.t = d
h.w = d
h.z = k
h.v = j
assert f.v.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: F = None
        self.t: C = None
        self.z: D = None
        self.w: C = None
        self.v: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: F = None
        self.v: E = None
        self.q: C = None
        self.w: E = None
        self.y: A = None
        self.s: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.t: B = None
        self.q: F = None
        self.x: F = None
        self.o: F = None
        self.txt = txt

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

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

b = A("b")
c = B("c")
d = C("d")
k = D("k")
f = E("f")
a = F("a")
j = E("j")
h = A("h")

b.q = c
b.p = a
b.t = d
b.w = d
b.z = k
b.v = f
c.t = a
c.s = a
c.v = j
c.w = j
c.q = d
c.y = b
d.p = f
d.s = k
d.u = c
k.r = c
k.t = c
k.q = a
k.x = a
k.o = a
f.v = b
f.r = h
f.q = h
a.p = d
j.v = h
j.r = h
j.q = h
h.q = c
h.p = a
h.t = d
h.w = d
h.z = k
h.v = j
assert f.v.w.p.txt == "f"