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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.r: E = None
        self.o: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.o: E = None
        self.s: F = None
        self.z: E = None
        self.v: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: B = None
        self.v: D = None
        self.p: A = None
        self.u: B = None
        self.y: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.v: B = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.r: E = None
        self.o: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.o: E = None
        self.s: F = None
        self.z: E = None
        self.v: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: B = None
        self.v: D = None
        self.p: A = None
        self.u: B = None
        self.y: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.v: B = None
        self.txt = txt

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

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

h.u = f
h.q = j
h.v = d
f.s = j
f.o = j
f.r = a
d.t = i
d.o = a
d.z = a
d.v = a
d.s = b
m.o = f
m.s = f
m.u = f
m.v = i
m.p = j
m.y = d
a.o = d
a.v = f
b.t = a
b.y = j
j.u = f
j.q = h
j.v = d
i.o = f
i.s = f
i.u = f
i.v = m
i.p = j
i.y = d
assert b.y.q.u.txt == "f"