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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: G = None
        self.t: G = None
        self.s: G = None
        self.v: E = None
        self.txt = txt

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

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: G = None
        self.t: G = None
        self.s: G = None
        self.v: E = None
        self.txt = txt

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

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

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