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

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.p: D = None
        self.w: F = None
        self.u: F = None
        self.o: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.z: F = None
        self.t: F = None
        self.txt = txt

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

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

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

b = A("b")
h = B("h")
d = C("d")
n = D("n")
j = E("j")
f = F("f")
g = E("g")

b.q = h
b.y = f
h.z = d
h.p = n
h.w = f
h.u = f
h.o = g
d.r = b
d.z = f
d.t = f
n.s = d
j.t = d
j.p = n
j.y = n
j.x = n
j.u = h
f.t = n
f.p = d
g.t = d
g.p = n
g.y = n
g.x = n
g.u = h
assert n.s.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.y: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.p: D = None
        self.w: F = None
        self.u: F = None
        self.o: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.z: F = None
        self.t: F = None
        self.txt = txt

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

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

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

b = A("b")
h = B("h")
d = C("d")
n = D("n")
j = E("j")
f = F("f")
g = E("g")

b.q = h
b.y = f
h.z = d
h.p = n
h.w = f
h.u = f
h.o = g
d.r = b
d.z = f
d.t = f
n.s = d
j.t = d
j.p = n
j.y = n
j.x = n
j.u = h
f.t = n
f.p = d
g.t = d
g.p = n
g.y = n
g.x = n
g.u = h
assert n.s.r.y.txt == "f"