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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: D = None
        self.u: D = None
        self.r: D = None
        self.txt = txt

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

k.r = h
k.w = h
k.p = m
d.u = j
d.q = k
f.y = m
f.t = a
h.w = k
h.t = k
h.q = k
h.r = d
h.u = f
h.x = m
m.o = d
a.q = h
a.u = h
a.r = h
j.y = m
j.t = a
assert f.y.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.w: D = None
        self.p: E = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: D = None
        self.u: D = None
        self.r: D = None
        self.txt = txt

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

k.r = h
k.w = h
k.p = m
d.u = j
d.q = k
f.y = m
f.t = a
h.w = k
h.t = k
h.q = k
h.r = d
h.u = f
h.x = m
m.o = d
a.q = h
a.u = h
a.r = h
j.y = m
j.t = a
assert f.y.o.q.txt == "k"