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

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

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

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

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

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

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

f.w = a
f.u = c
f.t = g
c.r = a
c.p = e
a.p = g
a.w = e
a.t = j
a.s = f
g.r = b
e.w = g
b.r = f
j.r = a
j.p = e
k.w = a
k.u = c
k.t = g
h.w = g
assert c.p.w.r.r.t.r.r.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: B = None
        self.t: D = None
        self.txt = txt

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

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

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

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

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

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

f.w = a
f.u = c
f.t = g
c.r = a
c.p = e
a.p = g
a.w = e
a.t = j
a.s = f
g.r = b
e.w = g
b.r = f
j.r = a
j.p = e
k.w = a
k.u = c
k.t = g
h.w = g
assert c.p.w.r.r.t.r.r.w.s.txt == "f"