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

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: C = None
        self.t: A = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

k = A("k")
d = B("d")
c = C("c")
h = D("h")
j = E("j")
g = F("g")
e = A("e")
m = D("m")
i = B("i")

k.p = g
k.s = g
k.x = e
d.s = c
d.x = c
d.t = e
c.p = k
c.u = e
h.y = c
j.v = d
j.r = i
g.q = c
e.p = g
e.s = g
e.x = k
m.y = c
i.s = c
i.x = c
i.t = e
assert k.p.q.u.x.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.x: A = None
        self.s: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: C = None
        self.t: A = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

k = A("k")
d = B("d")
c = C("c")
h = D("h")
j = E("j")
g = F("g")
e = A("e")
m = D("m")
i = B("i")

k.p = g
k.s = g
k.x = e
d.s = c
d.x = c
d.t = e
c.p = k
c.u = e
h.y = c
j.v = d
j.r = i
g.q = c
e.p = g
e.s = g
e.x = k
m.y = c
i.s = c
i.x = c
i.t = e
assert k.p.q.u.x.s.q.txt == "c"